﻿//************************************************************************************************
// Copyright © 2012 Steven M. Cohn. All Rights Reserved.
//
//************************************************************************************************ 

namespace CookieChipper
{
	using System;
	using System.Windows.Forms;


	/// <summary>
	/// 
	/// </summary>

	internal enum Workflow
	{
		Start,
		Backup,
		Restore,
		Complete
	}


	/// <summary>
	/// 
	/// </summary>

	internal enum PageStates
	{
		Empty,
		Ready,
		Complete
	}


	/// <summary>
	/// 
	/// </summary>
	/// <param name="forward"></param>

	internal delegate void PageNavigationHandler (bool forward);


	/// <summary>
	/// 
	/// </summary>
	/// <param name="state"></param>

	internal delegate void StateChangedHandler (WizardPage page, PageStates pageState);


	/// <summary>
	/// 
	/// </summary>

	internal class WizardPage : UserControl
	{
		protected PageStates pageState;

		public WizardPage ()
		{
			this.pageState = PageStates.Empty;
		}

		public event StateChangedHandler StateChanged;


		public string Description
		{
			get;
			protected set;
		}


		public virtual string Information
		{
			get;
			set;
		}

	
		public PageStates PageState
		{
			get
			{
				return pageState;
			}

			protected set
			{
				pageState = value;
				if (StateChanged != null)
				{
					StateChanged(this, pageState);
				}
			}
		}


		public virtual bool Execute ()
		{
			return true;
		}


		public virtual void OnEnterPage ()
		{
		}

		public virtual bool OnLeavePage (bool forward)
		{
			return true;
		}
	}
}
